<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>
        // 使用组合继承的方式，继承父构造函数的属性和方法
        function Father(uname, age, gender) {
            // console.log(this);

            this.uname = uname
            this.age = age
            this.gender = gender
        }

        Father.prototype.money = function () {
          console.log('赚了一个小目标')
        }
        // console.log(father.money());

        const father = new Father('韩', 50, '男')
        // console.log(father);

        // 属性继承
        function Son(uname, age, gender) {
            // console.log(this);
            Father.call(this, uname, age, gender)

            this.face
        }

        //继承实例化对象
        //原型链继承
        Son.prototype = new Father

        //手动指回构造函数
        Son.prototype.constructor = Son
        
        Son.prototype.smoke = function () {
            console.log(`我会跳舞`);
        }

        const son = new Son('韩', 28, '男', '唱歌')
        // console.log(son);
        // console.log(Son.prototype);

        son.money()

        son.smoke()

        father.money()

    </script>
</body>
</html>